#include <stdio.h>
#include <math.h>

int main( )
{
    int a, b, t, k, w;
    while( scanf("%d%d",&a,&b) != EOF )
    {
        if( a > b )
        {
            t = b;
            b = a;
            a = t;
        }
        k = b - a;
        w = int( k * ( 1.0 + sqrt( 5 ) ) / 2.0 );
        if ( w == a ) printf("%d\n", 0);
        else printf("%d\n", 1);
    }
}
